home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Creative Computers
/
Creative Computers CD-ROM, Volume 1 (Legendary Design Technologies, Inc.)(1994).iso
/
commercial
/
inovatronics
/
edgedemo
/
edgeeditor
/
rexx
/
menu_cmdshell.edge
< prev
next >
Wrap
Text File
|
1994-11-17
|
3KB
|
150 lines
/*
** $VER: CmdShell.edge 1.10 (Friday 08-Apr-94 10:37:24)
**
** Edge's command shell
**
** Written by Thomas liljetoft
*/
options results
options failat 100
/* get the name of the global port */
'get' g.devname rv edgehost
address value edgehost
/* are we already running */
'set' g.commandshellstatus Active
if result = "ACTIVE" then
do
'requestchoice' '"It appears that you already have a command-shell running.\010Do you wish to start this one anyway?"'
if RC ~= 0 then exit(0)
end
call open("stdin","console:",'R')
call open("stdout","console:",'W')
call writech('stdout',' ')
/* get users prefered text font */
'get' f.textfont
parse var result fontname','fontsize','
address command setfont fontname fontsize
say 'Enter commands, "Q" to exit, "?" for help.'
/* loop until user exits */
mainloop:
signal on break_f
/*
** NOTE: ctrl f will break the command shell without trying to reset F31.
*/
signal on break_c
signal on break_d
signal on break_e
signal on halt
signal on ioerr
signal on syntax
do forever
call writech('stdout','
'address()'>
')
cmd = readch('stdin',5000)
select
/* time to quit? */
when (length(cmd) = 2 & upper(left(cmd,1)) = "Q") then do
leave
end
/* need some help? */
when (length(cmd) = 2 & left(cmd,1) = "?") then do
say 'Enter "<command> ?" to obtain a command''s template.'
say 'Enter "HELP <command>" to obtain more help on a command.'
say 'Enter "Q" to exit command shell.'
say 'Enter "REXX <command>" to execute rexx commands.'
end
/* do nothing on empty lines, e.g. only one character == 'return key' */
when (length(cmd) = 1) then do
'Nop'
end
/* ctrl \ or closegadget return a null command */
when (cmd = "") then do
'closerexxio'
leave
end
/* whatsinaline */
otherwise do
/* if the commandstring starts with "rexx " interpret it as a rexx
instruction instead of as an Edge command */
if upper(left(cmd,5)) = "REXX " then do
interpret right(cmd,length(cmd) - 5)
end
else do
/* execute the command string, but first remove the NL character */
left(cmd,length(cmd) - 1)
/* if ok show the result, if any */
if RC == 0 then do
if result ~= "RESULT" then say result
end
else do
say "*** Edge Error : "EDGEERROR" - "EDGEERRORSTRING
end
end
end
end
end
'set' g.commandshellstatus
exit(0)
/* here comes the signal handler routines */
syntax:
say 'Oups.... 'errortext(RC)
signal mainloop
halt:
say 'Halted.'
'set' g.commandshellstatus
exit(0)
ioerr:
say 'IO error.'
signal mainloop
break_c:
say 'Break...'
'set' g.commandshellstatus
exit(0)
break_d:
say 'Break...'
'set' g.commandshellstatus
exit(0)
break_e:
say 'Break...'
'set' g.commandshellstatus
exit(0)
break_f:
say 'Break...'
exit(0)